{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 创建字典并增删改查\n",
    "\n",
    "创建一个字典{\"Math\": 96, \"English\": 86, \"Chinese\": 95.5, \"Biology\": 86, \"Physics\": None}，向字典中添加历史成绩88分，最后查看数学成绩。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Math       96.0\n",
      "English    86.0\n",
      "Chinese    95.5\n",
      "Biology    86.0\n",
      "Physics     NaN\n",
      "History    88.0\n",
      "dtype: float64\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "dict1 = {\"Math\": 96, \"English\": 86, \"Chinese\": 95.5, \"Biology\": 86, \"Physics\": None}\n",
    "dict1[\"History\"] = 88\n",
    "s1 = pd.Series(dict1)\n",
    "print(s1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "96.0"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1[\"Math\"]\n",
    "s1.get(\"Math\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python-data-analysis",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
